pull: Only fetch .archive-content for regular files
authorColin Walters <walters@verbum.org>
Thu, 23 Feb 2012 17:30:01 +0000 (12:30 -0500)
committerColin Walters <walters@verbum.org>
Thu, 23 Feb 2012 17:30:01 +0000 (12:30 -0500)
Otherwise e.g. Apache httpd might try to follow a symbolic link to
/bin/tinylogin which clearly won't work.

src/ostree/ostree-pull.c

index d1553c834bb6e5af9f1b1e5e0e0f8721ec73c8f3..6b954bac7452d8fb3dee9605d5006f84b3434954 100644 (file)
@@ -256,14 +256,6 @@ store_tree_recurse (OstreeRepo   *repo,
                              error))
             goto out;
 
-          g_clear_object (&content_file);
-          if (!fetch_object (repo, soup, base_uri, checksum,
-                             OSTREE_OBJECT_TYPE_ARCHIVED_FILE_CONTENT,
-                             &did_exist,
-                             &content_file,
-                             error))
-            goto out;
-
           if (!ostree_map_metadata_file (meta_file, OSTREE_OBJECT_TYPE_ARCHIVED_FILE_META,
                                          &archive_metadata, error))
             goto out;
@@ -271,8 +263,17 @@ store_tree_recurse (OstreeRepo   *repo,
           if (!ostree_parse_archived_file_meta (archive_metadata, &archive_file_info, &archive_xattrs, error))
             goto out;
 
+          g_clear_object (&input);
+          g_clear_object (&content_file);
           if (g_file_info_get_file_type (archive_file_info) == G_FILE_TYPE_REGULAR)
             {
+              if (!fetch_object (repo, soup, base_uri, checksum,
+                                 OSTREE_OBJECT_TYPE_ARCHIVED_FILE_CONTENT,
+                                 &did_exist,
+                                 &content_file,
+                                 error))
+                goto out;
+              
               input = (GInputStream*)g_file_read (content_file, NULL, error);
               if (!input)
                 goto out;